package com.edu.service.chat.impl;


import com.edu.entity.chat.*;
import com.edu.mapper.chat.EduChatMapper;
import com.edu.service.chat.EduChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EduChatServiceImpl implements EduChatService {

    @Autowired
    private EduChatMapper eduChatMapper;

    @Override
    public List<Chat> findchatlist(Page page) {
        List<Chat> list = eduChatMapper.findchatlist(page);
        return list;
    }

    @Override
    public List<Chat> findchatnewlist() {
        List<Chat> list = eduChatMapper.findchatnewlist();
        return list;
    }

    @Override
    public List<Chat> findchatnamelist(Page page) {
        return eduChatMapper.findchatnamelist(page);
    }

    @Override
    public List<Chat> finduserchatlist(int id) {
        return eduChatMapper.finduserchatlist(id);
    }

    @Override
    public List<Chat> findusereassylist(int id) {
        return eduChatMapper.findusereassylist(id);
    }

    @Override
    public List<Chat> findchatreserve(int id) {
        return eduChatMapper.findchatreserve(id);
    }

    @Override
    public int insertchat(Chat chat) {
        return eduChatMapper.insertchat(chat);

    }

    @Override
    public Chat getchatinfo(int id) {
        return eduChatMapper.getchatinfo(id);
    }

    @Override
    public void updatechat(Updatechat updatechat) {
        eduChatMapper.updatechat(updatechat);
    }

    @Override
    public int reservechat(Buy buy) {
        return eduChatMapper.reservechat(buy);
    }

    @Override
    public List<Buy> findbuylist(int id) {
        return eduChatMapper.findbuylist(id);
    }

    @Override
    public int insertessay(Essay essay) {
        return eduChatMapper.insertessay(essay);
    }

    @Override
    public List<Essay> findchatessay() {
        return eduChatMapper.findchatessay();
    }

    @Override
    public int getTotal(int pageCount) {
        Integer total = eduChatMapper.getTotal();
        return (total - 1)/ pageCount + 1;
    }

    @Override
    public int updatechatessay(int id) {
        return eduChatMapper.updatechatessay(id);
    }

    @Override
    public void chatnownumber(int id) {
        eduChatMapper.chatnownumber(id);
    }

    @Override
    public Essay essayshow(int id) {
        return eduChatMapper.essayshow(id);
    }

    @Override
    public List<Chat> pageList() {
        return eduChatMapper.pageList();
    }
}
